package com.ktjiaoyu.ktmall.service.impl;

import com.ktjiaoyu.ktmall.dao.UserDao;
import com.ktjiaoyu.ktmall.dao.impl.UserDaoImpl;
import com.ktjiaoyu.ktmall.entity.User;
import com.ktjiaoyu.ktmall.service.UserService;

public class UserServiceImpl implements UserService {

    @Override
    public User login(String username, String password) {
        UserDao userDao = new UserDaoImpl();
        User user = userDao.findByUsername(username);
        if (user!=null&&user.getPassword().equals(password)) {
            return user;
        }
        return null;
    }

    @Override
    public User findById(String id) {
        UserDao userDao = new UserDaoImpl();
        return userDao.findById(id);
    }

}
